//
//  UIStepperViewController.swift
//  Example
//
//  Created by T AO on 2022/2/16.
//

import UIKit

class UIStepperViewController: BaseViewController {

    override func viewDidLoad() {
        super.viewDidLoad()

        stepper()
    }
    
    private func stepper() {
        let stepper = UIStepper(frame: CGRect(x: 100, y: 200, width: 100, height: 20))
        view.addSubview(stepper)
        
        let label = UILabel(frame: CGRect(x: 100, y: 250, width: 200, height: 30))
        view.addSubview(label)
        
        stepper.rx.value
            .asObservable()
            .subscribe(onNext: { print("计步器当前值：\($0)") })
            .disposed(by: disposeBag)
        
        stepper.rx.value
            .map { "计步器当前值：\($0)" }
            .bind(to: label.rx.text)
            .disposed(by: disposeBag)
    }

}
